<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>课程详情</title>
    <link rel="stylesheet" href="./css/reset.css">
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
            margin: 0;
            padding: 0;
        }

        .container {
            width: 1200px;
            margin: 0 auto;
            background-color: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            margin-top: -30px;
        }

        a {
            text-decoration: none;
        }

        h1,
        h2,
        p {
            margin: 0;
            padding: 0;
        }

        .course-info {
            margin-bottom: 20px;
        }

        .course-info h1 {
            font-size: 24px;
            color: #333;
            margin-bottom: 20px;
        }
        #courseInstructor{
            color: #fff;
        }

        .course-info h2 {
            font-size: 18px;
            color: #666;
            margin-bottom: 10px;
        }

        .course-info p {
            font-size: 16px;
            color: #888;
            margin-bottom: 10px;
        }

        .chapter {
            margin-bottom: 20px;
        }

        .chapter-title {
            font-size: 16px;
            color: #333;
            margin-bottom: 5px;
            /* 调整章节标题与章节时长之间的间距 */
        }

        .chapter-duration {
            font-size: 14px;
            color: #666;
            margin-bottom: 10px;
        }

        #chapters {
            background: #f9f9f9;
            padding: 20px;
        }

        .header-bg {
            height: 60px;
            background: #000;
            line-height: 60px;
            padding: 0 100px;
            overflow: hidden;
        }

        #courseTitle {
            font-size: 50px;
            color: #fff;
        }

        .header-nav li {
            float: left;
            list-style: none;
            width: 80px;
            text-align: center;
        }

        .header-nav li a {
            color: #fff;
            display: inline-block;
            text-align: center;
        }

        .header-nav li a:hover {
            color: #007bff;
            text-decoration: none;
        }

        .header-nav li.active a {
            color: #007bff !important;
            text-decoration: none;
        }

        .coures-box {
            height: 300px;
            background: #000;
            /* background: linear-gradient(to right, #96c4fd, #adcefc); */
            text-align: center;
            padding-top: 110px;
            box-sizing: border-box;
            line-height: 50px;
            text-shadow: 0 2px 4px rgba(255, 255, 255, .6);
            position:relative;
        }
        .coures-bg{
            position: absolute;
            top:0;
            left: 0;
            background: #ccc;
            z-index: 1;
            width: 100%;
            height: 100%;
        }
        .coures-con{
            position: relative;
            z-index: 2;
        }

        .price-box {
            width: 900px;
            height: 100px;
            background: #fff;
            border-radius: 20px;
            margin: 0 auto;
            position: relative;
            top: -60px;
            font-size: 14px;
            box-sizing: border-box;
            padding: 20px;
            position: relative;
            z-index: 2;
        }

        .price {
            font-size: 32px;
            color: #f01414;
            line-height: 32px;
            font-weight: 700;
            margin-left: 8px;
        }
        .buy{
            width: 100px;
            height: 30px;
            background: #f01414;
            color: #fff;
            border-radius: 5px;
            border: none;
            float: right;
        }
    </style>
</head>

<body>
    <div class="header-bg">
        <!--导航-->
        <div class="header-nav">
            <li><a href="./index.html">首页</a></li>
            <li class="active"><a href="./course.html">课程</a></li>
            <li><a href="./spectrumList.html">谱例</a></li>
        </div>
    </div>
    <div class="coures-box">
        <div class="coures-con">
            <h1 id="courseTitle"></h1>
            <p id="courseInstructor"></p>
        </div>
        <div class="coures-bg" style="background: url('./images/img.jpg') no-repeat center center; background-size:cover; opacity: 0.1;"></div>
    </div>
    <!-- 价格区域 -->
    <div class="price-box">
        <div class="price">￥ 298.00</div>
        <div><button class="buy">购买</button></div>
    </div>
    <div class="container">
        <h3>课程目录</h3>
        <div id="chapters"></div>
        <!-- <h3>课程详情</h3>
        <div>
            
        </div> -->
    </div>

    <script src="./js/jquery.js"></script>
    <script>
        // JSON 数据
        var courseData = {
            "title": "小白钢琴弹唱速成",
            "code": "CS101",
            "instructor": "面包",
            "credit": 3,
            "schedule": "每周一、三、五 10:00 - 12:00",
            "chapters": [
                {
                    "title": "第一章：了解钢琴弹唱",
                    "duration": "2小时"
                },
                {
                    "title": "第二章：简单弹唱",
                    "duration": "3小时"
                },
                {
                    "title": "第三章：升级弹唱和弦",
                    "duration": "2.5小时"
                },
                {
                    "title": "第四章：搞定节奏",
                    "duration": "2小时"
                }
            ]
        };

        // 将数据填充到页面中
        $(document).ready(function () {
            $("#courseTitle").text(courseData.title);
            $("#courseCode").text("课程编号: " + courseData.code);
            $("#courseInstructor").text("授课教师: " + courseData.instructor);
            $("#courseCredit").text("学分: " + courseData.credit);
            $("#courseSchedule").text("上课时间: " + courseData.schedule);

            // 填充章节信息
            var chaptersHtml = "";
            $.each(courseData.chapters, function (index, chapter) {
                chaptersHtml += '<div class="chapter">';
                chaptersHtml += '<h2 class="chapter-title">' + chapter.title + '</h2>';
                chaptersHtml += '<p class="chapter-duration">' + chapter.duration + '</p>';
                chaptersHtml += '</div>';
            });
            $("#chapters").html(chaptersHtml);
        });
    </script>

</body>

</html>